const namespace = 'jx_bill_test'
module.exports= {
  lintOnSave: undefined,
  productionSourceMap: false,
  css: {
    extract: false
  },
  configureWebpack:  config => {
    config.entry = {
      [namespace]: ["./src/main.js"]
    }
    return {
      output: {
        library: namespace,
        filename: process.env.NODE_ENV === 'production'
          ? `biz/${namespace}/js/[id].[contenthash:4].js`
          : '[id].js' ,
        chunkFilename: `biz/${namespace}/js/${namespace}.vendors.[contenthash:4].js`,
      },
      optimization: {
        runtimeChunk: false, // 依赖处理与bundle合并
        splitChunks: {
          cacheGroups: {
            default: false
          }
        }
      }
    }
  },
  devServer: {
    port: 8083,
    proxy: {
      '/jx_bill_test/api': {
        target: 'http://localhost:8888',
        changeOrigin: true,
        pathRewrite: {}
      },
      //登录验证API
      '/pms/api': {
        target: 'http://192.168.12.181:25008',
        changeOrigin: true,
        pathRewrite: {}
      },
      //消息中心API
      '/xdoMessage': {
        target: 'http://192.168.12.181:25082',
        changeOrigin: true,
        pathRewrite: {}
      },
      //公共参数API
      '/api/pcode': {
        target: 'http://192.168.10.134:32080',
        changeOrigin: true,
        pathRewrite: {}
      },
      //自定义配置API
      "/xdoConfig/api": {
        target: 'http://192.168.12.181:25081',
        changeOrigin: true,
        ws: false,
        pathRewrite: {}
      },
      //异步导入API
      '/xdoImportBackend/api': {
        target: 'http://192.168.12.181:25011',
        changeOrigin: true,
        ws: false,
        pathRewrite: {}
      },
      //异步导出/下载中心API
      '/exportasync/api': {
        target: 'http://192.168.12.181:22000',
        changeOrigin: true,
        pathRewrite: {}
      },
      //多语言API
      '/i18n/api': {
        target: 'http://192.168.10.134:25007',
        changeOrigin: true,
        pathRewrite: {}
      }
    }
  }
}
